<?php
session_start();
//判断程序是否安装
if (basename($_SERVER['PHP_SELF']) != 'install.php') {
    if (!file_exists('./function/install.lock')) {
        if (file_exists('./install.php'))
            header("Location:./install.php");
        else die('程序未安装，请联系管理员！');
    }
}
?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"/>
    <meta name="renderer" content="webkit"/>
    <meta name="force-rendering" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>学生信息管理系统</title>
    <link rel="icon" href="./src/img/favicon.ico">
    <link rel="shortcut icon" href="./src/img/favicon.ico">
    <link rel="stylesheet" href="./src/css/drxs.min.css"/>
</head>
<body class="mdui-drawer-body-left  mdui-appbar-with-toolbar <?php if (isset($_SESSION['uid'])) echo $_SESSION['theme_color'] . ' ' . $_SESSION['theme_accent_color'];
else echo "mdui-theme-primary-white mdui-theme-accent-blue"; ?>">
<!--顶部工具栏 -->
<div class="mdui-appbar mdui-appbar-fixed mdui-color-theme" id="head_tool_bar">
    <div class="mdui-toolbar">
        <span id="main_drawer_top" class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white"
              mdui-drawer="{target: '#main_drawer', swipe: true}" mdui-tooltip="{content: '打开/关闭抽屉导航'}"><i
                    class="mdui-icon material-icons ">menu</i></span>
        <a class="mdui-typo-title">学生信息管理系统</a>
        <div class="mdui-toolbar-spacer"></div>
        <a class="mdui-btn mdui-btn-icon" mdui-menu="{target: '#head_menu'}"><i class="mdui-icon material-icons">more_vert</i></a>
        <div class="mdui-menu" id="head_menu">
            <?php if (isset($_SESSION['uid'])) { ?>
                <!--已登录状态右上角菜单栏-->
                <div id="head_menu_refresh" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe5d5;</i>刷新
                    </a>
                </div>
                <div id="head_menu_settings" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe8b8;</i>设置
                    </a>
                </div>
                <div id="head_menu_logout" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe898;</i>退出
                    </a>
                </div>
            <?php } else { ?>
                <!--未登录状态右上角菜单栏-->
                <div id="head_menu_login" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe853;</i>登录
                    </a>
                </div>
                <div id="head_menu_refresh" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe5d5;</i>刷新
                    </a>
                </div>
                <div id="head_menu_docs" class="mdui-menu-item">
                    <a class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">&#xe0e0;</i>文档
                    </a>
                </div>
            <?php } ?>
        </div>
    </div>
    <?php if (basename($_SERVER['PHP_SELF']) == 'management.php') { ?>
        <!--基础信息页面Tab-->
        <div class="mdui-tab mdui-tab-centered" mdui-tab>
            <a href="#user_management" class="mdui-ripple mdui-tab-active mdui-text-color-black">用户管理</a>
            <a href="#class_management" class="mdui-ripple mdui-text-color-black">班级管理</a>
            <a href="#college_management" class="mdui-ripple mdui-text-color-black">学院管理</a>
            <a href="#classroom_management" class="mdui-ripple mdui-text-color-black">教室管理</a>
        </div>
    <?php } elseif (basename($_SERVER['PHP_SELF']) == 'course.php') { ?>
        <!--课程管理页面Tab-->
        <div id='course_tab' class='mdui-tab mdui-tab-centered' mdui-tab>
            <a href='#course_management' class='mdui-ripple mdui-tab-active mdui-text-color-black'>系统全部课程</a>
            <?php if ($_SESSION['utype'] == '管理员' || $_SESSION['utype'] == '教师') { ?>
                <a href='#add_course' class='mdui-ripple mdui-text-color-black'>添加新课程</a>
            <?php }
            if ($_SESSION['utype'] == '教师') { ?>
                <a href='#teaching_course' class='mdui-ripple mdui-text-color-black'>当前讲授课程</a>
            <?php } ?>
        </div>
    <?php } elseif (basename($_SERVER['PHP_SELF']) == 'score.php') { ?>
        <!--成绩信息页面Tab-->
        <div class='mdui-tab mdui-tab-centered' mdui-tab>
            <?php if ($_SESSION['utype'] == '教师' || $_SESSION['utype'] == '管理员') { ?>
                <a href='#add_score' class='mdui-ripple mdui-tab-active mdui-text-color-black'>添加成绩</a>
            <?php }
            if ($_SESSION['utype'] == '学生') { ?>
                <a href='#query_score' class='mdui-ripple mdui-text-color-black'>查询成绩</a>
            <?php }
            if ($_SESSION['utype'] == '管理员') { ?>
                <a href='#verify_score' class='mdui-ripple mdui-text-color-black' disabled='disabled'>成绩复核</a>
            <?php } ?>
        </div>
    <?php } elseif (basename($_SERVER['PHP_SELF']) == 'notice.php') { ?>
        <!--公告板页面Tab-->
        <div class='mdui-tab mdui-tab-centered' mdui-tab>
            <a href='#query_notice' class='mdui-ripple mdui-tab-active mdui-text-color-black'>公告查询</a>
            <?php if ($_SESSION['utype'] == '管理员' || $_SESSION['utype'] == '教师') { ?>
                <a href='#release_notice' class='mdui-ripple mdui-text-color-black'>发布公告</a>
            <?php }
            if ($_SESSION['utype'] == '管理员') { ?>
                <a href='#withdraw_notice' class='mdui-ripple mdui-text-color-black' disabled='disabled'>公告撤回</a>
            <?php } ?>
        </div>
    <?php } ?>
</div>
<!--顶部工具栏 end-->
